/// <summary>
// DBLinq.MySqlProviders - .NET Providers for MySql using the framework DBLinq under MIT license, author Jiri George Moudry
// http://linq.to/db
// and the CodeFx.MySqlProviders under GNU licence, author Laurent Morisseau
// http://www.codeplex.com/CodeFxMySqlProvider
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Laurent Morisseau
/// </summary>
/// <author><a href="mailto:laurent.morisseau@gmail.com">Laurent Morisseau</a></author>
/// 
using System;
using System.Collections.Generic;
using System.Text;

namespace DBLinq.MySqlProviders
{    public static class ConvertHelper
    {
        public static byte BoolToByte(bool myConvert)
        {
            if (myConvert)
                return 1;
            else
                return 0;
        }

        public static bool StringToBool(string myConvert)
        {
            if (!string.IsNullOrEmpty(myConvert) && myConvert.Equals("1"))
                return true;
            else
                return false;
        }

        public static bool IntToBool(int myConvert)
        {
            if (myConvert.Equals(1))
                return true;
            else
                return false;
        }
        public static bool uIntToBool(uint myConvert)
        {
            if (myConvert.Equals(1))
                return true;
            else
                return false;
        }
        public static bool uShortToBool(ushort myConvert)
        {
            if (myConvert.Equals(1))
                return true;
            else
                return false;
        }
        public static bool sByteToBool(sbyte myConvert)
        {
            if (myConvert.Equals(1))
                return true;
            else
                return false;
        }
        public static bool ByteToBool(byte myConvert)
        {
            if (myConvert.Equals(1))
                return true;
            else
                return false;
        }

	  public static bool CharToBool( char? myConvert )
	  {
		  if ( myConvert == null )
			  return false;
		  if ( myConvert.Equals ( '1' ) )
			  return true;
		  else
			  return false;
	  }

	  public static char BoolToChar( bool myConvert )
	  {
		  if ( myConvert)
			  return '1';
		  else
			  return '0';
	  }
	  public static uint BoolTouInt( bool myConvert )
        {
            if (myConvert)
                return 1;
            else
                return 0;
        }
        public static ushort BoolTouShort(bool myConvert)
        {
            if (myConvert)
                return 1;
            else
                return 0;
        }

        public static sbyte BoolTosByte(bool myConvert)
        {
            if (myConvert)
                return 1;
            else
                return 0;
        }
    }
}
